package com.quxiang.pay.model;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 初始化请求
 * 
 * @author liulu
 *
 */
public class PayOrderModel {

	private int orderId;
	private BigDecimal orderFee;
	private String orderOpenId;
	private String orderUnionId;
	private String orderCode;
	private int orderStatus;// 1已发送 2 成功 3失败
	private int orderGems;
	private String orderTokenId;
	private String transactionId;
	private String outTransactionId;
	private String bankType;
	private String bankBillno;
	private String timeEnd;
	private String orderErrorMsg;
	private Date createTime;
	private Date updateTime;

	public PayOrderModel() {

	}

	public PayOrderModel(PayCallbackModel payCallback) {
		this.orderId = Integer.parseInt(payCallback.getOut_trade_no());
		this.orderFee = new BigDecimal(payCallback.getTotal_fee()).multiply(new BigDecimal(10000));
		this.transactionId = payCallback.getTransaction_id();
		this.orderOpenId = payCallback.getSub_openid();
		this.outTransactionId = payCallback.getOut_transaction_id();
		this.bankType = payCallback.getBank_type();
		this.bankBillno = payCallback.getBank_billno();
		this.timeEnd = payCallback.getTime_end();
		this.orderErrorMsg = payCallback.getMessage()==null?"":payCallback.getMessage() + "--" + payCallback.getErr_msg()==null?"":payCallback.getErr_msg() + "--"
				+ payCallback.getPay_info()==null?"":payCallback.getPay_info();
		this.orderStatus = payCallback.getPay_result() == 0 ? 2 : 3;
	}

	public int getOrderId() {
		return orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	public BigDecimal getOrderFee() {
		return orderFee;
	}

	public void setOrderFee(BigDecimal orderFee) {
		this.orderFee = orderFee;
	}

	public String getOrderOpenId() {
		return orderOpenId;
	}

	public void setOrderOpenId(String orderOpenId) {
		this.orderOpenId = orderOpenId;
	}

	public String getOrderUnionId() {
		return orderUnionId;
	}

	public void setOrderUnionId(String orderUnionId) {
		this.orderUnionId = orderUnionId;
	}

	public int getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(int orderStatus) {
		this.orderStatus = orderStatus;
	}

	public String getOrderTokenId() {
		return orderTokenId;
	}

	public void setOrderTokenId(String orderTokenId) {
		this.orderTokenId = orderTokenId;
	}

	public String getTransactionId() {
		return transactionId;
	}

	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}

	public String getOutTransactionId() {
		return outTransactionId;
	}

	public void setOutTransactionId(String outTransactionId) {
		this.outTransactionId = outTransactionId;
	}

	public String getBankType() {
		return bankType;
	}

	public void setBankType(String bankType) {
		this.bankType = bankType;
	}

	public String getBankBillno() {
		return bankBillno;
	}

	public void setBankBillno(String bankBillno) {
		this.bankBillno = bankBillno;
	}

	public String getTimeEnd() {
		return timeEnd;
	}

	public void setTimeEnd(String timeEnd) {
		this.timeEnd = timeEnd;
	}

	public String getOrderErrorMsg() {
		return orderErrorMsg;
	}

	public void setOrderErrorMsg(String orderErrorMsg) {
		this.orderErrorMsg = orderErrorMsg;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public int getOrderGems() {
		return orderGems;
	}

	public void setOrderGems(int orderGems) {
		this.orderGems = orderGems;
	}

	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

}
